package com.nny.alarm.edit;

import android.content.Context;
import android.graphics.Color;

import com.nny.alarm.widget.IDialAdapter;
import com.uxwine.skin.Skin;

public abstract class DialAdapter implements IDialAdapter
{
	IDialAdapter.AdapterView mView;
	int mnPostion;
	protected int mnMax;
	protected Context mCtx;
	
	public DialAdapter(Context ctx)
	{
		mCtx = ctx;
	}
	
	
	@Override
	public int getMarkColor(int index)
	{
		if(index > mnMax)
			return Skin.getColor(mCtx, "dial_mark_color_disabled");
		
		if(index == mnPostion)
			return Skin.getColor(mCtx, "dial_mark_color_selected");
		
		return Skin.getColor(mCtx, "dial_mark_color_normal");
	}

	@Override
	public int getPosition()
	{
		return mnPostion;
	}

	@Override
	public void notifyDataSetChanged()
	{
		if(null != mView)
			mView.notifyDataSetChanged();
	}

	@Override
	public void setView(AdapterView v)
	{
		mView = v;
	}
	
	@Override
	public void setPosition(int position)
	{
		mnPostion = position;
	}
	
	@Override
	public int getMax()
	{
		return mnMax;
	}
	
	@Override
	public void setMax(int max)
	{
		mnMax = max;
	}
}
